<template>
  <div>
    <el-dropdown @command="handleCommand">
      <span class="el-dropdown-link">
        语言切换<i class="el-icon-arrow-down el-icon--right" />
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item
          command="zh"
          :disabled="$i18n.locale === 'zh'"
        >中文</el-dropdown-item>
        <el-dropdown-item
          command="en"
          :disabled="$i18n.locale === 'en'"
        >English</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
export default {
  name: 'Lang',
  data() {
    return {}
  },
  computed: {},
  created() {},
  methods: {
    handleCommand(command) {
      this.$i18n.locale = command
    }
  }
}
</script>
<style lang="scss" scoped>
.el-dropdown-link {
  color: #fff;
}
</style>
